﻿@namespace BulmaRazor.Components

@inherits InputBase<TValue>
@typeparam TValue


<input id="@Id" @attributes="Attributes" @bind-value="@ShowValue" @bind-value:event="@BindEvent"
    class="@classes" />

@code {
    
    /// <summary>
    /// 格式字符串，基于ToString(format) 适用于日期和数字
    /// </summary>
    [Parameter]
    public string Format { get; set; }

    private string ShowValue
    {
        get => ExtendMethods.GetShowValue(Value,Format);
        set
        {
            if (!value.SetRealValue(out TValue val, Format)) return;
            Value = val;
            ValueChanged.InvokeAsync(Value).GetAwaiter().GetResult();
        }
    }
}
